<?php

/**
 * Framework_Module_User_Logout
 *
 * @author      Ian Szewczyk <roamzero@gmail.com>
 * @copyright   (c) 2007 Ian Szewczyk. All rights reserved.
 * @license     http://www.opensource.org/licenses/bsd-license.php
 * @package Module
 * @filesource
 */


/**
 * Framework_Module_User_Logout
 *
 * @author Ian Szewczyk <roamzero@gmail.com>
 * @package Module
 */
class Framework_Module_User_Logout extends Framework_Module_User
{
	/**
	 * __construct
	 *
	 * Initializes the module: sets the default presenter, the allowed
	 * conrollers, and the allowed events
	 *
	 * @access 		public
	 * @return 		void
	 */
	public function __construct()
	{
		parent::__construct();
		$this->presenter = 'None';
	}

	/**
     * __default
     *
     * Logout and redirect
     *
     * @access 		public
     * @return 		mixed 		boolean true on success, PEAR_Error on failure
     */
	public function __default()
	{
		$this->session->destroy();
		setcookie('cacheToggle', 1, time()+60*60*24*30);
		//if ($_SERVER['HTTP_REFERER']) {
		//	Framework_Header::redirect($_SERVER['HTTP_REFERER']);
		//} else {
		Framework_Header::redirect('http://'.$_SERVER['HTTP_HOST']);
		//}
	}

	/**
     * __destruct
     *
     *
     * @access 		public
     * @return 		void
     */
	public function __destruct()
	{
		parent::__destruct();
	}
}


?>
